import * as _ from "@usemath/utils";
import { computed } from "vue";

export function getColor(value: string) {
  if (value === undefined) {
    return "";
  }
  if (value.indexOf("#") !== -1) {
    return value;
  }
  switch (value) {
    case "primary":
      return "var(--primary-color)";
    case "secondary":
      return "var(--secondary-color)";
    case "gray":
      return "var(--color-gray)";
  }
  return "";
}

export function getSize(value?: string | number) {
  if (value === undefined) {
    return "";
  }
  if (_.isNumber(value)) {
    return value + "px";
  }
  return value;
}

export function buildStyles(fn: any) {
  return computed<any>(fn);
}

export function buildClassNames(fn: any) {
  return computed<any>(fn);
}
